package com.james.config;

import com.james.constants.QueueConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: OrderMQConfig
 * @Author: JamesWang
 * @Date: 2021/4/22 17:35
 * @Description:
 * @Version:1.0
 */
@Configuration
public class OrderMQConfig {
    @Bean
    public Queue wxQueue() {
        return new Queue(QueueConstant.WX_SMS_QUEUE);
    }
    @Bean
    public DirectExchange wxEx() {
        return new DirectExchange(QueueConstant.WX_SMS_EX);
    }
    @Bean
    public Binding wxBind() {
        return BindingBuilder.bind(wxQueue()).to(wxEx()).with(QueueConstant.WX_SMS_KEY);
    }
}
